<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge" >
  <title>iOS原生 VS Flutter评测 | Grx Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="iOS原生 VS Flutter评测本人之前分别尝试用iOS原生和Flutter写了同一个小应用, 一个空气质量查询App, 名字叫Aireport, 目前已经分别上架了App Store.">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS原生 VS Flutter评测">
<meta property="og:url" content="http://yoursite.com/2018/09/10/iOS原生 VS Flutter评测/index.html">
<meta property="og:site_name" content="Grx Blog">
<meta property="og:description" content="iOS原生 VS Flutter评测本人之前分别尝试用iOS原生和Flutter写了同一个小应用, 一个空气质量查询App, 名字叫Aireport, 目前已经分别上架了App Store.">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/1.jpg">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/2.jpg">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/3.jpg">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/4.jpg">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/5.jpg">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/7.jpg">
<meta property="og:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/8.jpg">
<meta property="og:updated_time" content="2018-09-10T02:48:22.096Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="iOS原生 VS Flutter评测">
<meta name="twitter:description" content="iOS原生 VS Flutter评测本人之前分别尝试用iOS原生和Flutter写了同一个小应用, 一个空气质量查询App, 名字叫Aireport, 目前已经分别上架了App Store.">
<meta name="twitter:image" content="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/1.jpg">
  
    <link rel="alternative" href="/atom.xml" title="Grx Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link rel="stylesheet" href="/css/style.css">
</head>

<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
	<header id="header" class="inner">
		<a href="/" class="profilepic">
			
			<img lazy-src="/img/rufei.jpg" class="js-avatar">
			
		</a>

		<hgroup>
		  <h1 class="header-author"><a href="/">Grx</a></h1>
		</hgroup>

		
		<p class="header-subtitle">自我管理，知识管理，时间管理，阅读，语音写作，思维导图</p>
		

		
			<div class="switch-btn">
				<div class="icon">
					<div class="icon-ctn">
						<div class="icon-wrap icon-house" data-idx="0">
							<div class="birdhouse"></div>
							<div class="birdhouse_holes"></div>
						</div>
						<div class="icon-wrap icon-ribbon hide" data-idx="1">
							<div class="ribbon"></div>
						</div>
						
						<div class="icon-wrap icon-link hide" data-idx="2">
							<div class="loopback_l"></div>
							<div class="loopback_r"></div>
						</div>
						
						
						<div class="icon-wrap icon-me hide" data-idx="3">
							<div class="user"></div>
							<div class="shoulder"></div>
						</div>
						
					</div>
					
				</div>
				<div class="tips-box hide">
					<div class="tips-arrow"></div>
					<ul class="tips-inner">
						<li>菜单</li>
						<li>标签</li>
						
						<li>友情链接</li>
						
						
						<li>关于我</li>
						
					</ul>
				</div>
			</div>
		

		<div class="switch-area">
			<div class="switch-wrap">
				<section class="switch-part switch-part1">
					<nav class="header-menu">
						<ul>
						
							<li><a href="/">主页</a></li>
				        
							<li><a href="/tags/life">随笔</a></li>
				        
							<li><a href="/archives">所有文章</a></li>
				        
						</ul>
					</nav>
					<nav class="header-nav">
						<div class="social">
							
								<a class="github" target="_blank" href="https://github.com/ruixiaoguo" title="github">github</a>
					        
								<a class="weibo" target="_blank" href="https://weibo.com/u/3984935859?refer_flag=1005055010_" title="weibo">weibo</a>
					        
								<a class="rss" target="_blank" href="#" title="rss">rss</a>
					        
								<a class="zhihu" target="_blank" href="#" title="zhihu">zhihu</a>
					        
						</div>
					</nav>
				</section>
				
				
				<section class="switch-part switch-part2">
					<div class="widget tagcloud" id="js-tagcloud">
						<a href="/tags/OC/" style="font-size: 10px;">-OC</a> <a href="/tags/Android/" style="font-size: 10px;">Android</a> <a href="/tags/Apple-Watch/" style="font-size: 10px;">Apple Watch</a> <a href="/tags/Flutter/" style="font-size: 13.33px;">Flutter</a> <a href="/tags/Life/" style="font-size: 10px;">Life</a> <a href="/tags/Lottie/" style="font-size: 10px;">Lottie</a> <a href="/tags/MMKV/" style="font-size: 10px;">MMKV</a> <a href="/tags/MonkeyKing/" style="font-size: 10px;">MonkeyKing</a> <a href="/tags/OC/" style="font-size: 20px;">OC</a> <a href="/tags/RAC/" style="font-size: 11.67px;">RAC</a> <a href="/tags/Swift/" style="font-size: 15px;">Swift</a> <a href="/tags/WKWebView/" style="font-size: 10px;">WKWebView</a> <a href="/tags/WebView/" style="font-size: 10px;">WebView</a> <a href="/tags/Xcode/" style="font-size: 18.33px;">Xcode</a> <a href="/tags/appledoc/" style="font-size: 10px;">appledoc</a> <a href="/tags/hexo/" style="font-size: 11.67px;">hexo</a> <a href="/tags/ios/" style="font-size: 10px;">ios</a> <a href="/tags/life/" style="font-size: 16.67px;">life</a> <a href="/tags/xcode/" style="font-size: 10px;">xcode</a>
					</div>
				</section>
				
				
				
				<section class="switch-part switch-part3">
					<div id="js-friends">
					
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://blog.devtang.com">唐巧的博客</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://beyondvincent.com">破船之家</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://limboy.me">无网不剩</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://msching.github.io">码农人生</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://yulingtianxia.com">玉令天下</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://blog.leichunfeng.com">雷纯锋的技术博客</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://jax.cnblogs.com">包建强</a>
			        
			          <a target="_blank" class="main-nav-link switch-friends-link" href="http://blog.cnbang.net">bang</a>
			        
			        </div>
				</section>
				

				
				
				<section class="switch-part switch-part4">
				
					<div id="js-aboutme">知识管理，时间管理，自我管理，阅读，语音写作，思维导图，Wiz，TimeMeter</div>
				</section>
				
			</div>
		</div>
	</header>				
</div>

    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
  	<div class="overlay">
  		<div class="slider-trigger"></div>
  		<h1 class="header-author js-mobile-header hide">Grx</h1>
  	</div>
	<div class="intrude-less">
		<header id="header" class="inner">
			<div class="profilepic">
			
				<img lazy-src="/img/rufei.jpg" class="js-avatar">
			
			</div>
			<hgroup>
			  <h1 class="header-author">Grx</h1>
			</hgroup>
			
			<p class="header-subtitle">自我管理，知识管理，时间管理，阅读，语音写作，思维导图</p>
			
			<nav class="header-menu">
				<ul>
				
					<li><a href="/">主页</a></li>
		        
					<li><a href="/tags/life">随笔</a></li>
		        
					<li><a href="/archives">所有文章</a></li>
		        
		        <div class="clearfix"></div>
				</ul>
			</nav>
			<nav class="header-nav">
				<div class="social">
					
						<a class="github" target="_blank" href="https://github.com/ruixiaoguo" title="github">github</a>
			        
						<a class="weibo" target="_blank" href="https://weibo.com/u/3984935859?refer_flag=1005055010_" title="weibo">weibo</a>
			        
						<a class="rss" target="_blank" href="#" title="rss">rss</a>
			        
						<a class="zhihu" target="_blank" href="#" title="zhihu">zhihu</a>
			        
				</div>
			</nav>
		</header>				
	</div>
</nav>

      <div class="body-wrap"><article id="post-iOS原生 VS Flutter评测" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a href="/2018/09/10/iOS原生 VS Flutter评测/" class="article-date">
  	<time datetime="2018-09-10T02:28:47.000Z" itemprop="datePublished">2018-09-10</time>
</a>
    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      iOS原生 VS Flutter评测
    </h1>
  

      </header>
      
      <div class="article-info article-info-post">
        
	<div class="article-tag tagcloud">
		<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Flutter/">Flutter</a></li></ul>
	</div>

        

        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="iOS原生-VS-Flutter评测"><a href="#iOS原生-VS-Flutter评测" class="headerlink" title="iOS原生 VS Flutter评测"></a>iOS原生 VS Flutter评测</h1><p>本人之前分别尝试用iOS原生和Flutter写了同一个小应用, 一个空气质量查询App, 名字叫Aireport, 目前已经分别上架了App Store.<br><a id="more"></a></p>
<blockquote>
<p>本人之前分别尝试用iOS原生和Flutter写了同一个小应用, 一个空气质量查询App, 名字叫Aireport, 目前已经分别上架了App Store.</p>
</blockquote>
<ol>
<li>Aireport(iOS原生)</li>
<li>Aireport Flutter(Flutter版<br>Aireport原本是我自己在用, 但是在初步学习了Flutter后我决定用Flutter最大限度的去模仿iOS原生版的应用, 以评估Flutter是否有能力做到以假乱真的地步. 我们在上一篇文章中已经探讨了Flutter在开发中可能遇到的问题, 这篇文章我们将着重放在两者用户在实际体验中的差距.</li>
</ol>
<h2 id="1-安装包大小"><a href="#1-安装包大小" class="headerlink" title="1.安装包大小"></a>1.安装包大小</h2><p>安装包大小决定了用户等待下载的时间和可能会耗费的流量, 即便是即将迈入5G时代的今天, 我们依然需要尽量优化应用安装的大小.</p>
<blockquote>
<p>Flutter应用安装包和安装后容量</p>
</blockquote>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/1.jpg" alt="avatar"></p>
<blockquote>
<p>iOS原生应用安装包和安装后容量</p>
</blockquote>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/2.jpg" alt="avatar"></p>
<p> 虽然Flutter的结果我多少能够猜到, 但安装包9倍, 磁盘占用4倍的差距还是让我感到失望, 何况如果我使用OC开发的话安装包还能进一步缩小(WWDC有可能将swift设为稳定版嵌入iOS系统内核, 届时swift版将有望自动瘦身).</p>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/3.jpg" alt="avatar"></p>
<p>由于项目很小就百行代码, 因此这30MB的空间占用基本就是Flutter的SDK容量.30MB的空间对于一款App来说已经是一个不小的数字, 而且应用之间不能共享SDK, 有几个Flutter应用就会有几个Flutter SDK. 这让技术团队在选择开发框架时不得不着重考虑一下今后App的容量问题.</p>
<h2 id="2-启动速度"><a href="#2-启动速度" class="headerlink" title="2.启动速度"></a>2.启动速度</h2><p>上面的应用容量除了影响磁盘占用外, 对启动速度也会有影响. 我在iPhone X上实测了一下, iOS原生应用的冷启动速度大概是在0.4秒左右, 而Flutter的冷启动速度在1.5秒左右.</p>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/4.jpg" alt="avatar"></p>
<p>毫无意外iOS这一局又占上风. Flutter的启动过程首先会去跑完完整的iOS原生应用的所有流程直至第一个ViewController实例化后,再由VC去调用加载Flutter SDK, 初始化Flutter的运行时环境. 也就是说Flutter应用的启动时间=iOS原生应用的启动时间+Flutter环境的启动时间. 用户对于应用的容量占用几乎很难察觉, 但是应用的启动时间对用户体验的影响绝对是致命的(虽然现在的启屏广告已经完全不考虑用户体验了). 在这一点上不知道往后Google团队还有没有优化的空间.</p>
<h2 id="3-内存占用"><a href="#3-内存占用" class="headerlink" title="3.内存占用"></a>3.内存占用</h2><p>内存占用一直是移动开发中的一个优化重点.不过目前来看Release版的Flutter在内存占用这一块也没有任何优势, SDK拖累是一方面, 单个页面内存占用也比原生多一倍.</p>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/5.jpg" alt="avatar"></p>
<p>注意, 我们知道Flutter在Build版本中的性能和Release是不一样的, 同一个应用, Build版的内存占用在100M左右, 为了热加载我也是忍了.<br>内存占用不仅影响着应用性能、电池损耗、 程序稳定性, 最重要但是, 内存占用越大, 被系统干掉后台的可能性就越大. 我自己的使用体验来看, iOS原生的Aireport基本上大部分时间都处于休眠状态, 而Flutter会在关闭不久后直接被系统干掉.</p>
<h2 id="4-流畅度"><a href="#4-流畅度" class="headerlink" title="4.流畅度"></a>4.流畅度</h2><p>从框架一出现,60FPS似乎始终贯穿于各大Flutter的介绍和分析文章中, 这让我们对Flutter的流畅度非常期待.然而:</p>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/7.jpg" alt="avatar"></p>
<p>上面是iOS原生App的帧率, 下面是Flutter的帧率, 很明显这是一个尴尬的结果.Flutter应用在运行过程中频繁出现了红色的警告, 这表明应用在这段时间没没有以60帧的速度完美渲染出页面.<br>这种帧率的差距也体现在了实际使用中. 无论是页面的切换, 还是ListView的滚动, Flutter都仅仅能达到还算流畅的程度, 但明显还达不到iOS原生60帧的丝般顺滑. 当然, 目前的Flutter还处在Beta版, 而且我个人认为, 相对于安装包大小和启动速度, 运行时的流畅度更容易进行优化. 我相信Flutter将在之后的版本中进一步优化应用的流畅度, 达到与原生媲美的程度.</p>
<h2 id="5-iOS特性支持"><a href="#5-iOS特性支持" class="headerlink" title="5.iOS特性支持"></a>5.iOS特性支持</h2><p>iOS应用开发受益于强大的iOS系统和丰富的生态体系, 天生就具有大量实用且不可替代的特性, 例如Bitcode能够在云端自动优化我们App的代码, 原生应用默认就支持增量更新、后台应用刷新等等.</p>
<p><img src="https://qidianlife.oss-cn-shanghai.aliyuncs.com/qidian_iOS/iOS原生%20VS%20Flutter评测/8.jpg" alt="avatar"></p>
<p>很显然Apple赋予iOS应用的这些种种特性与Flutter应用是无缘的, 如果Flutter能够支持热更新的化那么其可用价值就高了许多. 但目前实现起来还有诸多问题, 包括部署、性能问题, 以及苹果对于热更新的谨慎态度.<br>综合了目前Flutter在开发中的体验以及和原生应用的比较, 我目前对Flutter的评估结果是: 再等等.<br>Flutter的确提供了一种不同于目前其他跨平台开发框架的思路, 也极有可能成为未来跨平台开发的标杆. 如果你是个人开发, 我还是建议你学习一下Flutter, 它的Dart语言、Wiget化、数据绑定、单向数据流等等现代特性值得你去了解. 同时对于无法同时掌握多个移动开发平台的小伙伴而言, 使用Flutter也是一种成本较为低廉的方法. 但是对于公司而言, Flutter还无法完全投入生产环境, 而且初期Flutter的开发成本未必会低于原生平台.<br>目前Fuchsia的开发进度还不得而知, Flutter也还处在Beta3阶段. 相信等Fuchsia正式发布的时候才是检验Flutter正在实力的时候.</p>

      
    </div>
    
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/09/10/Lottie初级教程：打造iOS APP完美动画/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption"><</strong>
      <div class="article-nav-title">
        
          Lottie初级教程：打造iOS APP完美动画
        
      </div>
    </a>
  
  
    <a href="/2018/09/05/iOS RAC的使用总结/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">iOS RAC的使用总结</div>
      <strong class="article-nav-caption">></strong>
    </a>
  
</nav>

  
</article>


<div class="share_jia">
	<!-- JiaThis Button BEGIN -->
	<div class="jiathis_style">
		<span class="jiathis_txt">Share to: &nbsp; </span>
		<a class="jiathis_button_facebook"></a> 
    <a class="jiathis_button_twitter"></a>
    <a class="jiathis_button_plus"></a> 
    <a class="jiathis_button_tsina"></a>
		<a class="jiathis_button_cqq"></a>
		<a class="jiathis_button_douban"></a>
		<a class="jiathis_button_weixin"></a>
		<a class="jiathis_button_tumblr"></a>
    <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	</div>
	<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=1405949716054953" charset="utf-8"></script>
	<!-- JiaThis Button END -->
</div>






<div class="duoshuo">
	<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="iOS原生 VS Flutter评测" data-title="iOS原生 VS Flutter评测" data-url="http://yoursite.com/2018/09/10/iOS原生 VS Flutter评测/"></div>
	<!-- 多说评论框 end -->
	<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
	<script type="text/javascript">
	var duoshuoQuery = {short_name:"true"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
	<!-- 多说公共JS代码 end -->
</div>




</div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info">
    	<div class="footer-left">
    		&copy; 2019 Grx
    	</div>
      	<div class="footer-right">
      		<a href="http://hexo.io/" target="_blank">Hexo</a>  Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
      	</div>
    </div>
  </div>
</footer>
    </div>
    
  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">


<script>
	var yiliaConfig = {
		fancybox: true,
		mathjax: true,
		animate: true,
		isHome: false,
		isPost: true,
		isArchive: false,
		isTag: false,
		isCategory: false,
		open_in_new: false
	}
</script>
<script src="http://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
<script src="/js/main.js"></script>






<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
        processEscapes: true,
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    }
});

MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for(i=0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';                 
    }       
});
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  </div>
</body>
</html>